package ar.com.personalTravellers.daos.impl;

import java.util.Collection;

import ar.com.personalTravellers.beans.Neighborhood;
import ar.com.personalTravellers.beans.Zone;
import ar.com.personalTravellers.daos.NeighborhoodDAO;

import com.angel.architecture.persistence.ids.ObjectId;
import com.angel.dao.generic.impl.GenericSpringHibernateDAO;

/**
 *
 * @author William
 */
public class NeighborhoodSpringHibernateDAO extends GenericSpringHibernateDAO<Neighborhood, ObjectId> implements NeighborhoodDAO {

    public NeighborhoodSpringHibernateDAO() {
        super(Neighborhood.class, ObjectId.class);
    }

    public Neighborhood findUniqueByName(String name) {
        return super.findUnique("name", name);
    }

    public Collection<Neighborhood> findAllByZone(Zone zone) {
        return super.findAll("zone", zone);
    }

    public Collection<Neighborhood> findAllByZoneName(String zoneName) {
        Zone zone = Zone.valueOf(zoneName);
        return super.findAll("zone", zone);
    }

    public Collection<Neighborhood> findAllByActive(Boolean active) {
        return super.findAll("active", active);
    }

    public Collection<Neighborhood> findAllActives() {
        return this.findAllByActive(true);
    }

    public Collection<Neighborhood> findAllUnactives() {
        return this.findAllByActive(false);
    }
}